package com.zds.service.impl;

import com.zds.dao.UserDao;
import com.zds.entity.User;
import com.zds.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @className:UserServiceImpl
 * @date: 2024/12/14 下午4:34
 * @description:
 */
@Service("userService")
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao userDao;
    public static String name;
    public UserServiceImpl() {
        System.out.println("UserServiceImpl constructor");
    }

    /**
     * BeanFactory去调用该方法。从容器中获得UserDao设置到此处
     */
    public void setUserDao(UserDao userDao) {
        System.out.println("UserServiceImpl.setUserDao()从Beanfactory获取到：" + userDao);
    }

    public  void getName(){
        System.out.println("name=========="+name);
    }

    public void setName(String name) {
        this.name = name;
    }
    public List<User> findAll(){
//        int a = 1/0;
      return userDao.findAll();
    }
}
